package cz.schovjan.proj.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;

import cz.schovjan.proj.model.Constants.Roles;

@Entity
@Table(name="USER", schema="PPRO")
public class UserEntity {
	
    private String nick;
    private String name;
    private String surname;
    private String password;
    private String sign;
    private Date dateCreate;
    private String email;
    private Roles role;

	public UserEntity() {
	}
	
	public UserEntity(String nick, String name, String surname,
			String password, String sign, Date dateCreate, String email, Roles role) {
		this.nick = nick;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.sign = sign;
		this.dateCreate = dateCreate;
		this.email = email;
		this.role = role;
	}

	@Id
	@Column(name="NICK", unique=true, nullable=false, length=20)
	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	@Column(name="NAME", length=50)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name="SURNAME", length=50)
	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	@Column(name="PASSWORD", length=20, nullable=false)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name="SIGN", length=150)
	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	@Column(name="DATE_CREATE")
	public Date getDateCreate() {
		return dateCreate;
	}

	public void setDateCreate(Date dateCreate) {
		this.dateCreate = dateCreate;
	}
	
	@Column(name="EMAIL", length=100)
	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name="ROLE", nullable=false)
	@Enumerated(EnumType.ORDINAL)
	public Roles getRole() {
		return role;
	}

	public void setRole(Roles role) {
		this.role = role;
	}
	
	@Override
	public String toString() {
		return "User [nick=" + nick + ", name=" + name
				+ ", surname=" + surname + ", password=" + password
				+ ", sign=" + sign + ", dateCreate=" + dateCreate + ", role="
				+ role + "]";
	}
}